def findMaxConsecutiveOnes(nums):
    if not nums:
        return 0
    for i in range(1, len(nums)):
        if nums[i] == 1:
            nums[i] = nums[i - 1] + 1
        else:
            nums[i] = 0
    return max(nums)


nums = [1, 1, 1, 0, 1]
print(findMaxConsecutiveOnes(nums))  # 3
